<template>
  <uni-section
    v-if="
     
      data.billType === 'GCSB'
    "
    title="待确认工程队信息"
    type="line"
  >
    <uni-card class="card">
      <view class="spec-item mb-5" v-if="tableData.length" v-for="(item, j) in tableData" :key="j">
        <view class="number"> 序号：{{ j + 1 }} </view>
        <text
          class="card-item"
          v-for="(ix, zx) in addPlanProjectAppQuotationColumns"
          :key="zx"
        >
          <text class="title">{{ ix.title }}</text
          >：{{
            ix?.render ? ix?.render(item?.[ix.dataIndex]) : item?.[ix.dataIndex]
          }}</text
        >
        <view class="action-detail" style="flex-basis: 100%" v-if=" dataOne?.activitiInstance?.formKey === 'confirmQuotation' "> 
		<!-- //查看没有这个button -->
          <button
            @click="change(item)"
            :class="item.isConfirm === '0' ? 'color-audit' : 'color-confirm '"
          >
            {{ item.isConfirm === "0" ? "确认" : "取消确认 " }}
          </button>
        </view>
      </view>
	  <view v-else class="no-data"> 暂无数据 </view>
    </uni-card>
  </uni-section>
</template>

<script>
import { addPlanProjectAppQuotationColumns } from "./api";
import request from "@/utils/httpInterceptor";

export default {
  props: {
    data: Object,
    dataOne: Object,
  },
  data() {
    return {
      tableData: [],
      addPlanProjectAppQuotationColumns,
    };
  },
  created() {
    uni.showLoading();
    this.getList();
  },
  methods: {
    async getList() {
      const res = await request({
        url: `/project/project-declare-quotation/list`,
        method: "POST",
        data: {
          projectDeclareId: this.dataOne.id,
        },
      });
      if (res?.data?.length) {
        this.tableData = res.data;
      }
    },
    async change(item) {
      if (item.isConfirm === "0") {
        await request({
          url: `/project/project-declare-quotation/confirm/${item.id}`,
          method: "GET",
        });
      } else {
        await request({
          url: `/project/project-declare-quotation/confirm/cancel/${item.id}`,
          method: "GET",
        });
      }
	  this.getList()
    },
  },
};
</script>

<style lang="scss" scoped>
</style>
